package org.jivesoftware.smackx.packet;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.jivesoftware.smack.packet.IQ;

public class MUCAdmin extends IQ
{
  private List<Item> items = new ArrayList();

  public Iterator<Item> getItems()
  {
    synchronized (this.items)
    {
      return Collections.unmodifiableList(new ArrayList(this.items)).iterator();
    }
  }

  public void addItem(Item paramItem)
  {
    synchronized (this.items)
    {
      this.items.add(paramItem);
    }
  }

  public String getChildElementXML()
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("<query xmlns=\"http://jabber.org/protocol/muc#admin\">");
    synchronized (this.items)
    {
      for (int i = 0; i < this.items.size(); i++)
      {
        Item localItem = (Item)this.items.get(i);
        localStringBuilder.append(localItem.toXML());
      }
    }
    localStringBuilder.append(getExtensionsXML());
    localStringBuilder.append("</query>");
    return localStringBuilder.toString();
  }

  public static class Item
  {
    private String actor;
    private String reason;
    private String affiliation;
    private String jid;
    private String nick;
    private String role;

    public Item(String paramString1, String paramString2)
    {
      this.affiliation = paramString1;
      this.role = paramString2;
    }

    public String getActor()
    {
      return this.actor;
    }

    public String getReason()
    {
      return this.reason;
    }

    public String getAffiliation()
    {
      return this.affiliation;
    }

    public String getJid()
    {
      return this.jid;
    }

    public String getNick()
    {
      return this.nick;
    }

    public String getRole()
    {
      return this.role;
    }

    public void setActor(String paramString)
    {
      this.actor = paramString;
    }

    public void setReason(String paramString)
    {
      this.reason = paramString;
    }

    public void setJid(String paramString)
    {
      this.jid = paramString;
    }

    public void setNick(String paramString)
    {
      this.nick = paramString;
    }

    public String toXML()
    {
      StringBuilder localStringBuilder = new StringBuilder();
      localStringBuilder.append("<item");
      if (getAffiliation() != null)
        localStringBuilder.append(" affiliation=\"").append(getAffiliation()).append("\"");
      if (getJid() != null)
        localStringBuilder.append(" jid=\"").append(getJid()).append("\"");
      if (getNick() != null)
        localStringBuilder.append(" nick=\"").append(getNick()).append("\"");
      if (getRole() != null)
        localStringBuilder.append(" role=\"").append(getRole()).append("\"");
      if ((getReason() == null) && (getActor() == null))
      {
        localStringBuilder.append("/>");
      }
      else
      {
        localStringBuilder.append(">");
        if (getReason() != null)
          localStringBuilder.append("<reason>").append(getReason()).append("</reason>");
        if (getActor() != null)
          localStringBuilder.append("<actor jid=\"").append(getActor()).append("\"/>");
        localStringBuilder.append("</item>");
      }
      return localStringBuilder.toString();
    }
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smackx.packet.MUCAdmin
 * JD-Core Version:    0.6.1
 */